/**
 * 
 */
package com.jm.web.form.baseitem;

import com.jm.utils.StringHelper;

/**
 * @author yanjie
 *
 * 2011/10/6 下午4:26:54
 */
public class CalendarItem extends BaseItem{
	/**
	 * @param tag
	 */
	public CalendarItem() {};
	
	@Override
	public void init() {
		super.init();
		this.setNodeName("input");
		this.SetExtValue("autocomplete", "off");
		this.SetExtValue("type", "text");
		this.SetExtValue("class", "Wdate");

		if(this.GetExtValue("style","").indexOf("width:") < 0){
			this.setStyle(StringHelper.Format("width:100px;%1$s ;",this.getStyle()));
		}
		this.SetExtValue("onfocus", StringHelper.Format("if(!$(this).isactive(true)) return false;WdatePicker1({el:this%1$s})",((this.GetExtValue("calConfig", "")).length() > 0 ? "," : "")+ this.GetExtValue("calConfig", "")));
//		this.SetExtValue("onfocus", StringHelper.Format("WdatePicker()"));
		this.SetExtValue("onblur","try{var oldvalue = $(this).val().trim();if(oldvalue != ''){$dp.cal.checkAndUpdate();if(oldvalue != $(this).val().trim()){$(this).val('');} }}catch(e){}");
		this.RemoveExtValue("calConfig");//用完删除
	}
}
